package com.gdth.bank.adapter;

import java.util.List;

import com.gdth.bank.bean.FlashBean;

import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

public class ImageBrowesAdapter extends PagerAdapter {  
	/**
	 * 滑动的图片集合  
	 */
	private List<FlashBean> flashList;
	
	public ImageBrowesAdapter(List<FlashBean> flashList){
		this.flashList = flashList;
	}
	
    @Override  
    public int getCount() {  
        return flashList.size();  
    }  

    @Override  
    public Object instantiateItem(View arg0, int arg1) {
    	ViewPager mViewPager = (ViewPager) arg0;
    	FlashBean mFlashBean = flashList.get(arg1);
    	
    	mViewPager.addView(mFlashBean.getImgView());
        
        return mFlashBean.getImgView();  
    }  

    @Override  
    public void destroyItem(View arg0, int arg1, Object arg2) {  
    	ViewPager mViewPager = (ViewPager) arg0;
    	
    	mViewPager.removeView((View) arg2);  
    }  

    @Override  
    public boolean isViewFromObject(View arg0, Object arg1) {  
        return arg0 == arg1;  
    }  

    @Override  
    public void restoreState(Parcelable arg0, ClassLoader arg1) {  

    }  

    @Override  
    public Parcelable saveState() {  
        return null;  
    }  

    @Override  
    public void startUpdate(View arg0) {  

    }  

    @Override  
    public void finishUpdate(View arg0) {  

    }  

}
